package Vista;
import java.awt.BorderLayout;
import java.awt.FlowLayout;


import javax.swing.JScrollPane;

import java.awt.GridLayout;
import java.util.Vector;

import javax.swing.DefaultListModel;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.text.JTextComponent;

import Controlador.CntrlCompra;
import Modelo.Accion;
import Modelo.Ingrediente;



public class VistaCompra extends JFrame {

	private static final long serialVersionUID = 1L;
	
	public JLabel lblIngrediente;
	public JTextField txtCantidadCom;
	public JTextField txtCodigoCom;
	public JLabel lblCantidadCom;
	
	public JLabel lblTitulo; 
	
	public JScrollPane jScrollPaneProdOrden;
	public JButton btnRegistrar;
	
	public JButton btnLimpiar;
	public JButton btnSalir;
	public JComboBox cmbIngredientes;
	private Vector<String> ingrediente;
	Accion accion=new Accion();
	private JPanel pnNorte,pnBotones,panel1;
	
	CntrlCompra cntrlCompra;
	Ingrediente ingred;

	
	
	 public VistaCompra() {
		
		setTitle("      ***Comida Rapida***  ");
		this.setSize(430,330);
		
		txtCantidadCom = new JTextField(10);
		lblTitulo = new JLabel("***** Registrar Compras****");
		lblIngrediente = new JLabel("Ingredientes:");
		lblCantidadCom = new JLabel("Cantidad:");
		
		ingrediente=accion.cargarIngredientes();
		cmbIngredientes=new JComboBox(ingrediente);
		
		btnRegistrar = new JButton("Registrar");
		btnSalir = new JButton("    Salir   ");
		
	
	
pnNorte= new JPanel(new GridLayout(8,4));
		
        panel1= new JPanel(new FlowLayout(FlowLayout.CENTER));
        panel1.add(lblTitulo);
		pnNorte.add(panel1);
		
		panel1= new JPanel(new FlowLayout(FlowLayout.LEFT));
		panel1.add(lblIngrediente);
		panel1.add(cmbIngredientes);
		pnNorte.add(panel1);
		
		panel1= new JPanel(new FlowLayout(FlowLayout.LEFT));
		panel1.add(lblCantidadCom);
		panel1.add(txtCantidadCom);
		pnNorte.add(panel1);
	
			
	
     pnBotones=new JPanel(new GridLayout(2,3));
		
    panel1= new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel1.add(btnRegistrar);
    panel1.add(btnSalir); 
    pnBotones.add(panel1);
		
		
		add(pnNorte,BorderLayout.NORTH);
		add(pnBotones,BorderLayout.SOUTH);
		

		asignarControladora();
		
	}	
	
	 private void asignarControladora() {
			
			cntrlCompra = new CntrlCompra(this);
			btnRegistrar.addActionListener(cntrlCompra);
			btnSalir.addActionListener(cntrlCompra);
			//addWindowListener(cntrlCategoria);
		}

	public JTextComponent getTxtCodigoCom() {
		// TODO Auto-generated method stub
		return txtCodigoCom;
	}	
	
	public JTextComponent getTxtCantidadCom() {
		// TODO Auto-generated method stub
		return txtCantidadCom;
	}	

}
